package aconcagua.measure

abstract class DerivedUnit extends SimpleUnit {

	// accessing
	@Override
	public nothingAmount() {
		return this. convertAmountFromBaseUnit(this.baseUnit().nothingAmount());
	}

	// converting - private
	abstract protected convertAmountFromBaseUnit(aNumber);
	
	@Override
	protected convertFromBaseUnit(aMeasure) {
		return new Measure(this.convertAmountFromBaseUnit(aMeasure.amount()), this);
	}

	@Override
	protected convertToBaseUnit(aMeasure) {
		return new Measure(this.convertAmountToBaseUnit(aMeasure.amount()),
			this.baseUnit());
	}

}
